import { request } from './request'

const rezRouter = '/rez'

export const apiCreateRez = (data) => {
  var raw = JSON.stringify({
    "venue_id": data.venueId,
    "start_time": data.startTime,
    "end_time": data.endTime,
    "week": data.week,
    "mode": 0,
    "amount": data.amount,
  });
  return request(rezRouter, "post", raw)
}

export const apiUpdateRez = (data) => {
  var raw = JSON.stringify({
    "id": data.id,
    "status": data.status,
  });
  return request(rezRouter, "put", raw)
}


export const apiFindPersonalRez = (data) => {
  const { page, pageSize,status } = data
  return request(rezRouter + `/findByNo?status=${status}&&page=${page}&&pageSize=${pageSize}`)
}

export const apiFindAllRez = (data) => {
  const { page, pageSize, startTime } = data
  var raw = JSON.stringify({
    start_time: startTime,
    status: 2,
  })
  return request(rezRouter + `/findAll?page=${page}&&pageSize=${pageSize}`, "post", raw)
}

export const apiFirstRez = () => {
  return request(rezRouter + `/first`)
}

export const apiCancelRez = (id) => {
  var raw = JSON.stringify({
    id: id,
    status: 3,
  })
  return request(rezRouter,"put",raw)
}